if [ "${PS1-}" ]; then
  if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then
    # The file bash.bashrc already sets the default PS1.
    # PS1='\h:\w\$ '
    if [ -f /etc/bash.bashrc ]; then
      . /etc/bash.bashrc
    fi
  else
    if [ "`id -u`" -eq 0 ]; then
      PS1='# '
    else
      PS1='$ '
    fi
  fi
fi

if [ -d /etc/profile.d ]; then
  for i in /etc/profile.d/*.sh; do
    if [ -r $i ]; then
      . $i
    fi
  done
  unset i
fi
export CQLSH_NO_BUNDLED=TRUE
log_file=/data/logs/history.log
if [ ! -f $log_file ]; then
touch $log_file
chmod 777 $log_file
fi
 if ! test -z  "$BASH_EXECUTION_STRING" ; then
         echo "===== $(date "+%F  %T") $USER nologin cmd:   $BASH_EXECUTION_STRING" >>$log_file
 elif  shopt -q login_shell ; then
         echo "=== $(date "+%F  %T") new login ${SSH_TTY:5} $USER from ${SSH_CLIENT%% *}">>$log_file
 else
         echo "=== $(date "+%F  %T") su ${SSH_TTY:5} $USER from ${SSH_CLIENT%% *}">>$log_file
 fi
#  export HISTTIMEFORMAT="%F %T  $USER  ${SSH_TTY:5} ${SSH_CLIENT%% *}  "
#  export PROMPT_COMMAND="history  1|tail -1|sed 's/^[ ]\+[0-9]\+   //'>> $log_file"
export PROMPT_COMMAND='{ date "+%y-%m-%d %T ##### $(who am i |awk "{print \$1\" \"\$2\" \"\$5}") #### $(pwd) #### $(history 1 | { read x cmd; echo "$cmd"; })"; } >> $log_file'

alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
#alias rm='rm -i'
alias rm="sh /data/bin/remove.sh"
alias cp='cp -i'
alias mv='mv -i'
alias de='de(){ docker exec -it $1 bash; };de'
alias dp='docker ps -a'
alias vi=vim
alias kubesys='kubectl -n kube-system'


export JAVA_HOME JRE_HOME PATH CLASSPATH JAVA_BIN
export LD_LIBRARY_PATH=/usr/local/apr/lib
export LD_RUN_PATH=/usr/local/apr/lib
export PS1=$'\\n\\\n[\\[\\e[32m\\]\\u\\[\\e[0m\\]\\\n@\\\n\\[\\e[35m\\]\\H \\\n\\[\\e[36;1m\\]\\w\\\n\\[\\e[0m\\]] \\\n$(RETVAL="$?"; echo -en "\\e[33m{$(date +%H:%M:%S)} ";\n  if [ "$RETVAL" -eq 0 ];then\n echo -en "\\[\\e[32m\\]($RETVAL)"\n else\n echo -en "\\[\\e[31;1m\\a\\]($RETVAL)"\n fi)\\n\\\n\\[\\e[0;1;34m\\]\\$ \\[\\e[0m\\]'
#export GREP_OPTIONS='--color=auto'